package configuration.dataObjects
{
	import mx.collections.ArrayCollection;
	[Bindable]
	public class AllocationRuleDetailDO
	{
		public var ALLOCATION_RULE:String = "";
		public var QUANTITY_UM:String = "";
		public var SEQUENCE:String = "";
		public var STRATEGY:String = "";
		public var LOC_SEL_ID:Number = 0;
		public var LOC_SEL_DESC:String = "";
		public var OBJECT_ID:Number = 0;
		public var ROLL_IN_NEXT_UM:String = "";

		public function AllocationRuleDetailDO()
		{
		}
	
		public function Init(xmlObj:XML):void{				
			if(null == xmlObj)
				return;
			else{
				for each (var itemProp:XML in xmlObj.children()) {			
					this[itemProp.name()] = itemProp;
				}
			}
		}
		
		public function ToXML():XML{
			var xmlObj:XML =
				<ALLOCATION_RULE_DETAIL>
					<ALLOCATION_RULE>{ALLOCATION_RULE}</ALLOCATION_RULE>
					<QUANTITY_UM>{QUANTITY_UM}</QUANTITY_UM>
					<SEQUENCE>{SEQUENCE}</SEQUENCE>
					<STRATEGY>{STRATEGY}</STRATEGY>
					<LOC_SEL_ID>{LOC_SEL_ID}</LOC_SEL_ID>
					<LOC_SEL_DESC>{LOC_SEL_DESC}</LOC_SEL_DESC>
					<OBJECT_ID>{OBJECT_ID}</OBJECT_ID>
					<ROLL_IN_NEXT_UM>{ROLL_IN_NEXT_UM}</ROLL_IN_NEXT_UM>
				</ALLOCATION_RULE_DETAIL>;
			return xmlObj;
		}
		
		public static function getItems(list:XMLList):ArrayCollection
		{
			var ac:ArrayCollection = new ArrayCollection();
			for each(var xml:XML in list)
			{
				var itm:AllocationRuleDetailDO = new AllocationRuleDetailDO();
				itm.Init(xml);
				ac.addItem(itm);
			}
			return ac;
		}
	}
}